-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow username and password to be passed into register with flags #401
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
dc80785
to
2a66084
Compare
2a66084
to
a344428
Compare
a344428
to
ca1259a
Compare
let password = password_flag.map_or_else( | ||
|| match rpassword::prompt_password("Password: ") { | ||
Ok(p) => { | ||
if p.is_empty() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't look like the original code had this check, is it needed?
I assume there could be cases where we don't want to include a password at all (e.g. when using certs). Does this check get avoided for those cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code didn't have this check as I thought that prompt_password
returned an error on am empty password, but it does not.
Even when using certs cbshell needs the username and password to perform any doc ops. Also when we register a cluster through the config file we return an error if there is no username and password, so I think it should be the same when registering a cluster through this command.
The other place this is used is when creating credentials, where we obviously need a username and password. I think if there was something that used wither certs or username/password it'd be the responsibility of the caller to call this func if they require a username and password, and don't if a cert has been supplied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the context, makes sense.
By default the
cb-env register
command prompts for the user name and password to be entered after running the command, allowing the password to be hidden. We should support passing the username and password in using flags to allow registering multiple clusters without having to repeatedly enter the same username and password.